#include "../include/noeud.h"

	
Noeud::Noeud( Position pos, Noeud* fin)
{
	this->pos = pos;
	Position dest;
	if( fin == NULL )
		dest = pos;
	else
		dest = fin->getPosition();

	float distx = dest.x - pos.x ;
	float disty = dest.y - pos.y ;
	cout = sqrt( (distx * distx) + (disty * disty) );

	predecesseur = NULL;
}

float Noeud::getCout()
{
	return cout;
}

void Noeud::setPredecesseur( Noeud* n)
{
	predecesseur = n;

}


Noeud* Noeud::getPredecesseur()
{
	return predecesseur;
}


Position Noeud::getPosition()
{
	return pos;
}

void Noeud::setObstacle(Bloc ob)
{
    obstacle = ob;   
}

Bloc Noeud::getObstacle()
{
    return obstacle;
}

bool Noeud::is(Noeud n)
{
    
    // If same coords as int
    if( (int) getPosition().x == (int) n.getPosition().x 
        && (int) getPosition().y == (int) n.getPosition().y )
        return true;
    else
        return false;
}
